local cuimian_active = fk.CreateSkill {
  name = "#th_cuimian_active",
}

cuimian_active:addEffect("active", {
  card_num = 0,
  card_filter = Util.FalseFunc,
  min_target_num = 1,
  max_target_num = 2,
  target_filter = function(self, player, to_select, selected, _, _, extra_data)
    local card = Fk:getCardById(extra_data.card_id)
    card.skillName = "th_cuimian"
    if table.contains(extra_data.targets, to_select.id) then
      if #selected < 1 then
        return true
      elseif #selected < 2 then
        return selected[1]:canUseTo(card, to_select, extra_data.extra_data)
      end
    end
  end,
  target_tip = function(self, player, to_select, selected, _, _, selectable, extra_data)
    if not selectable then return end
    if not table.contains(selected, to_select) then
      if #selected == 0 then
        return { {content = "@@th_cuimianObtain", type = "normal"} }
      else
        return { {content = "@@th_cuimianTarget", type = "normal"} }
      end
    else
      if #selected == 1 then
        return { {content = "@@th_cuimianObtain", type = "normal"} }
      elseif selected[1] == to_select then
        return { {content = "@@th_cuimianUser", type = "normal"} }
      else
        return { {content = "@@th_cuimianTarget", type = "normal"} }
      end
    end
  end
})

Fk:loadTranslationTable{
  ["@@th_cuimianUser"] = "使用者",
  ["@@th_cuimianTarget"] = "目标",
  ["@@th_cuimianObtain"] = "获得牌",
}

return cuimian_active